﻿<div class="fitem_auto padding_H" id="Root">
    <div v-show="msg" class="msgbox_alert">{{msg}}</div>
    <div v-show="active">
        <buttonlist :hook="hooks[0]" :set="sets[0]" class="wyjcontainer_H border_B padding_V"></buttonlist>
        <pagenation :hook="hooks[1]" :set="table" :api="Api" hasToolbar="yes">
            <template #toolbar="postData">
                <input placeholder="请输入客户名称" v-model="postData.queryKeys.key" />
            </template>
            <template #td="models">
                <td><a class="tooltip" @@click="Switch(3, models.model)">{{models.model.Name}}<span class="tooltiptext">查看详情</span></a></td>
                <td>{{models.model.Phone}}</td>
                <td>{{models.model.Address}}</td>
                <td>
                    <a v-for="(btn,i) in icons" :key="i" :class="btn.class" @@click="btn.act(models.model)"><i :class="btn.icon"></i></a>
                </td>
            </template>
        </pagenation>
    </div>
    <div v-show="!active" class="exclusive wyjcontainer_V">
        <buttonlist :hook="hooks[2]" :set="sets[1]" class="wyjcontainer_HL border_B padding_V"></buttonlist>
        <editor :hook="hooks[3]" :set="labels">
            <template v-if="viewMode" #ele>
                <div class="formGroup_ele" v-for="(y,x) in labels" :key="x">{{model[x]}}</div>
            </template>
            <template v-else #ele="slotProps">
                <input class="formGroup_ele" v-model="model.Name" placeholder="请输入客户名称" />
                <input class="formGroup_ele" v-model="model.Phone" placeholder="请输入联系电话" />
                <input class="formGroup_ele" v-model="model.Address" placeholder="请输入联系地址" />
            </template>
            <template #subtmpl>
            </template>
        </editor>
        <buttonlist :hook="hooks[4]" :set="sets[2]" class="wyjcontainer_HM padding_V border_T"></buttonlist>
    </div>
</div>

@section foot {
    <script type="text/javascript">
        var app = new App({
            Api: 'Customer',
            table: {
                titles: ["客户名称", "联系电话", "联系地址", "操作"],
            },
            PageTitles: ['客户列表', '新增客户', '编辑客户', '查看客户'],
            icons: [{
                icon:'fa fa-trash',
                act: (e, i) => {
                    app.DeleteById(e.Id, i)
                }
            }, {
                icon:'fa fa-pencil-square-o',
                act: (e) => {
                    app.Switch(2, e);
                }
            }],
            labels: {
                Name:'客户名称',
                Phone: '联系电话',
                Address: '联系地址',
            },
        });
    </script>
}